﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MShop.Core.Domain
{
    public partial class ShopUserRights
    {
        public override bool Equals(object obj)
        {
            if (obj == null)
                return false;
            if (obj is ShopUserRights)
            {
                ShopUserRights B = (ShopUserRights)obj;
               
                if (B.MenuId == this.MenuId && B.UserId == this.UserId)
                    return true;
            }
            return false;
        }

        public override int GetHashCode()
        {
            return this.UserId.GetHashCode()+this.MenuId.GetHashCode();
        }

        public RightFlags RightFlags
        {
            get
            {
                if (this.Rights != 0)
                {
                   return  (RightFlags)this.Rights;
                }
                return RightFlags.NoRight;
            }
            set
            {
                this.Rights = (int)value;
            }
        }
    }
}